//
//  RepoterView.m
//  GIFShow
//
//  Created by 陈凯 on 15/6/5.
//  Copyright (c) 2015年 CK. All rights reserved.
//

#import "RepoterView.h"

@interface RepoterView()
@property (nonatomic, strong) CustomButton * likeButton;
@property (nonatomic, strong) CustomButton * dingButton;
@property (nonatomic, strong) UIButton * shareButton;
@property (nonatomic, strong) UIButton * moreInfoButton;
@end

@implementation RepoterView

-(instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        [self setupSubViews];
    }
    return self;
}
-(void)setupSubViews{
    // 顶
    
    self.likeButton = [CustomButton buttonWithType:UIButtonTypeCustom];
    [self.likeButton setTitle:@"like" forState:UIControlStateNormal];
    [self.likeButton setImage:[UIImage imageNamed:@"xihuanmiaobian"] forState:UIControlStateNormal];
    [self.likeButton setImage:[UIImage imageNamed:@"xihuantianse"] forState:UIControlStateSelected];
    [self.likeButton setTintColor:[UIColor redColor]];
    
    [self.likeButton setTitleColor:[UIColor colorWithRed:250/255.0 green:64/255.0 blue:64/255.0 alpha:0.95] forState:UIControlStateNormal];
    [self.likeButton setTitleShadowColor:[UIColor blueColor] forState:UIControlStateNormal];
    [self addSubview:self.likeButton];
 
    self.dingButton = [CustomButton buttonWithType:UIButtonTypeCustom];
    [self.dingButton setTitle:@"favor" forState:UIControlStateNormal];
    [self.dingButton setImage:[UIImage imageNamed:@"shoucang"] forState:UIControlStateNormal];
    [self.dingButton setImage:[UIImage imageNamed:@"shoucang1"] forState:UIControlStateSelected];
    
    [self.dingButton setTitleColor:[UIColor colorWithRed:240/255.0 green:160/255.0 blue:73/255.0 alpha:0.95] forState:UIControlStateNormal];
    [self.dingButton setTitleShadowColor:[UIColor blueColor] forState:UIControlStateNormal];
    [self addSubview:self.dingButton];
       // 分享
    self.shareButton = [UIButton buttonWithType:UIButtonTypeSystem];
    [self.shareButton setImage:[UIImage imageNamed:@"share"] forState:UIControlStateNormal];
    self.shareButton.imageView.contentMode = UIViewContentModeScaleAspectFit ;
    [self addSubview:self.shareButton];
    // 其他
    self.moreInfoButton = [UIButton buttonWithType:UIButtonTypeSystem];
    [self.moreInfoButton setTitle:@"" forState:UIControlStateNormal];
    [self.moreInfoButton setImage:[UIImage imageNamed:@"gengduo"] forState:UIControlStateNormal];
    [self.moreInfoButton setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
    [self.moreInfoButton setTitleShadowColor:[UIColor blueColor] forState:UIControlStateNormal];
    [self addSubview:self.moreInfoButton];
    
    self.likeButton.frame = CGRectMake(self.frame.size.width*0.05, 0, self.frame.size.width*0.28, self.frame.size.width*0.11);
    NSInteger dingValue = 0;
    [self.likeButton setTitle:[NSString stringWithFormat:@"%d",(int)dingValue] forState:UIControlStateNormal];
    
    self.dingButton.frame = CGRectMake(self.likeButton.frame.origin.x + self.likeButton.frame.size.width, 0, self.frame.size.width*0.28, self.frame.size.width*0.11);
    NSInteger favourValue = 0;
    [self.dingButton setTitle:[NSString stringWithFormat:@"%d",(int)favourValue] forState:UIControlStateNormal];
    
    
    self.shareButton.frame = CGRectMake(self.dingButton.frame.origin.x + self.dingButton.frame.size.width, 0, self.frame.size.width*0.12, self.frame.size.width*0.12);
    
    self.moreInfoButton.frame = CGRectMake(self.frame.origin.x + self.frame.size.width - self.frame.size.width*0.13, 0, self.frame.size.width*0.12, self.frame.size.width*0.12);
    
//    self.likeButton.tag = self.indexPath.row + 100;
//    self.dingButton.tag = self.indexPath.row + 101;
//    self.shareButton.tag = self.indexPath.row + 102;
//    self.moreInfoButton.tag = self.indexPath.row + 103;
    
//    CGRect mainBackFrame = self.frame;
//    mainBackFrame.size.height = self.mainLabel.frame.origin.y+self.mainLabel.frame.size.height+self.dingButton.frame.size.height + 10;
//    mainBackFrame.size.width = self.bounds.size.width - 4;
//    self.frame = mainBackFrame;
    

}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
